<script>
	 $(function(){
  $('.confirm').click(function(){
    var r=confirm("Apakah Anda yakin akan menghapus data? ")
  if (r==false)
    {
    return false;
    }
  });
});  
</script>
<?php if(!defined('BASEPATH')) exit ('No direct script access allowed');?>
<div id="main-content">
	<div class='title'>Daftar Surat Masuk</div>
	<?php echo anchor('con_surat_masuk/tambah','<img src="'.base_url().'asset/icon/tambah.png" alt="Tambah" width="45" height="25" />');?>
	<?php //echo anchor('con_surat_masuk/tambah','Tambah Surat Masuk Baru');?>
	<table class='data' width='100%'>
		<tr>
			<th width='5%' align='center'>No</th>
			<th width='20%' align='center'>No Surat</th>
			<th width='15%' align='center'>Tanggal Surat</th>
			<th width='47%' align='center'>Asal</th>
			<th width='13%' align='center'>Aksi</th>
		</tr>
		<?php
		//start of penomoran
		if(!$this->uri->segment(3))
		{
			$no = 1;
		}else
		{
			$no = $this->uri->segment(3)+1;
		}
		//end of penomoran
		//foreach($all_surat_masuk->result() as $row)
		foreach($all_surat_masuk as $row)
		{
		?>
		<tr>
			<td><?php echo $no ;?></td>
			<td><?php echo $row->NO_SURAT;?></td>
			<td align='center'><?php 
			$this->load->helper('tanggal');
			$strdate = $row->TANGGAL_SURAT;
			$date = strtotime($strdate);
			$tgl = date('d',$date);
			$bulan = date('m',$date);
			$nmbulan = konversiBulan($bulan);
			$tahun = date('Y',$date);
			echo $tgl.'-'.$nmbulan.'-'.$tahun;

			//echo $row->TANGGAL_SURAT;?></td>
			<td align='left'><?php echo $row->NAMA_KANTOR;?></td>
			<td align='center'>
			<?php
			echo anchor('con_surat_masuk/edit/'.$row->ID_SURAT_MASUK,'<img src="'.base_url().'asset/icon/edit.png" alt="Hapus" width="20" height="20" />');
			echo ' - ';
			echo anchor('con_surat_masuk/hapus/'.$row->ID_SURAT_MASUK,'<img src="'.base_url().'asset/icon/hapus.png" alt="Hapus" width="20" height="20" />',array('class'=>'confirm'));
			?>
			</td>
		</tr>
		<?php
		$no++;
		}
		?>
		</table>
		<?php echo $halaman; ?>
</div>